import HomePage from "@/pages/home";
import LoginPage from "@/pages/login";
import LayoutC from "@/layout";
import NotFoundPage from "@/pages/404";
import { Navigate } from "react-router-dom";
import AssetsListPage from "@/pages/assetsList";
import AssetsStatisticsPage from "@/pages/assetsStatistics";
import RoleManagePage from "@/pages/roleManage";
import AuthManagePage from "@/pages/authManage";
import PersonnelManagePage from "@/pages/personnelManage";
import DevConfigPage from "@/pages/devConfig";
import DevInfoPage from "@/pages/devInfo";
import DTUListPage from "@/pages/dtuList";
import SIMListPage from "@/pages/simList";

// 配置路由映射 （不同的路由对应渲染不同的页面组件）
const router = [
  {
    path: "/",
    element: <Navigate to="/login" />,
  },
  {
    path: "/layout",
    name: "Layout",
    element: <LayoutC />,
    children: [
      // 首页
      {
        path: "/layout/home",
        name: "Home",
        meta: {
          title: "首页",
          key: "0",
          isHide: false,
          icon: "home",
        },
        element: <HomePage />,
      },
      // 资产统计
      {
        path: "/layout/assetsStatistics",
        name: "AssetsStatistics",
        meta: {
          title: "资产统计",
          key: "1",
          isHide: false,
          icon: "assetsStatistics",
        },
        element: <AssetsStatisticsPage />,
      },
      // 资产列表
      {
        path: "/layout/assetsList",
        name: "AssetsList",
        meta: {
          title: "资产列表",
          key: "2",
          isHide: false,
          icon: "assetsList",
        },
        element: <AssetsListPage />,
      },
      // 用户管理
      {
        path: "/layout/userManage",
        name: "UserManage",
        meta: {
          title: "用户管理",
          key: "3",
          isHide: false,
          icon: "userManage",
        },
        children: [
          // 角色管理
          {
            path: "/layout/userManage/roleManage",
            name: "RoleManage",
            meta: {
              title: "角色管理",
              key: "4",
              isHide: false,
              icon: "roleManage",
            },
            element: <RoleManagePage />,
          },
          // 权限管理
          {
            path: "/layout/userManage/authManage",
            name: "AuthManage",
            meta: {
              title: "权限管理",
              key: "5",
              isHide: false,
              icon: "authManage",
            },
            element: <AuthManagePage />,
          },
          // 人员管理
          {
            path: "/layout/userManage/personnelManage",
            name: "PersonnelManage",
            meta: {
              title: "人员管理",
              key: "6",
              isHide: false,
              icon: "personnelManage",
            },
            element: <PersonnelManagePage />,
          },
        ],
      },
      // 设备管理
      {
        path: "/layout/devManage",
        name: "DevManage",
        meta: {
          title: "设备管理",
          key: "7",
          isHide: false,
          icon: "devManage",
        },
        children: [
          // 设备配置
          {
            path: "/layout/devManage/devConfig",
            name: "DevConfig",
            meta: {
              title: "设备配置",
              key: "8",
              isHide: false,
              icon: "devConfig",
            },
            element: <DevConfigPage />,
          },
          // 设备信息
          {
            path: "/layout/devManage/devInfo",
            name: "DevInfo",
            meta: {
              title: "设备信息",
              key: "9",
              isHide: false,
              icon: "devInfo",
            },
            element: <DevInfoPage />,
          },
          // DTU管理
          {
            path: "/layout/devManage/dtuManage",
            name: "DTUManage",
            meta: {
              title: "DTU管理",
              key: "10",
              isHide: false,
              icon: "dtuManage",
            },
            children: [
              // DTU列表
              {
                path: "/layout/devManage/dtuManage/dtuList",
                name: "DTUList",
                meta: {
                  title: "DTU列表",
                  key: "11",
                  isHide: false,
                  icon: "dtuList",
                },
                element: <DTUListPage />,
              },
              // SIM列表
              {
                path: "/layout/devManage/dtuManage/simList",
                name: "SIMList",
                meta: {
                  title: "SIM列表",
                  key: "12",
                  isHide: false,
                  icon: "simList",
                },
                element: <SIMListPage />,
              },
            ],
          },
        ],
      },
    ],
  },
  {
    path: "/login",
    name: "Login",
    element: <LoginPage />,
  },
  {
    path: "*",
    element: <NotFoundPage />,
  },
];

export default router;
